package com.beiing.tianshuai.tianshuai.mine.presenter;

import com.beiing.tianshuai.tianshuai.mine.entity.OrderCommentDataBean;
import com.beiing.tianshuai.tianshuai.mine.model.OrderCommentModel;
import com.beiing.tianshuai.tianshuai.mine.model.OrderCommentModelImpl;
import com.beiing.tianshuai.tianshuai.mine.view.OrderCommentViewImpl;

import java.util.List;

/**
 * Created by Administrator on 2018/4/19.
 */

public class OrderCommentPresenter implements OrderCommentPresenterImpl,
        OrderCommentModel.OrderCommentDataResponseListener {

    private OrderCommentViewImpl mView;
    private OrderCommentModelImpl mModel;

    public OrderCommentPresenter(OrderCommentViewImpl view) {
        mView = view;
        mModel = new OrderCommentModel(this);
    }

    /**
     * 写入评论参数
     * @param aid  活动id
     * @param from_uid 用户id
     * @param order_id 订单id
     * @param contents 评论内容
     * @param order_star 订单五星
     * @param logistics_star 物流五星
     * @param merch_star 举办方五星
     * @param anonymous 是否匿名
     * @param imgPaths 图片路径list
     */
    @Override
    public void setOrderComment(String aid, String from_uid, String order_id, String contents,
                                String order_star, String logistics_star, String merch_star,
                                 String anonymous, List<String> imgPaths) {
        mView.showProgress();
        mModel.setOrderComment(aid, from_uid, order_id, contents, order_star, logistics_star,
                merch_star, anonymous, imgPaths);
    }

    @Override
    public void onGetDetailSuccess(OrderCommentDataBean bean) {
        //请求成功返回
        mView.hideProgress();
        mView.getOrderCommentSuccess(bean);
    }

    @Override
    public void onGetDetailError(Throwable throwable) {

    }
}
